package com.lyw.gulimall.search.controller;

import com.lyw.common.to.SkuEsModel;
import com.lyw.common.utils.R;
import com.lyw.gulimall.search.service.ElasticSearchSaveService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/search")
@Log4j2
@RestController
public class ElasticSearchSaveController {

    @Autowired
    private ElasticSearchSaveService elasticSearchSaveService;

    // 上架商品
    @PostMapping("/product")
    public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels) {
        elasticSearchSaveService.productStatusUp(skuEsModels);
        return R.ok();
    }
}
